import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:smart_home/model/first_type.dart';

Future<String> _loadFirstTypeJson() async {
  return await rootBundle.loadString("static/data/first_type.json");
}

Future<List<FirstType>> decodeFirstType() async {
  String firstTypeJson = await _loadFirstTypeJson();

  List jsonList = json.decode(firstTypeJson);

  List<FirstType> firstTypeList= [];

  for(var i = 0; i < jsonList.length; i++){
    FirstType firstTypeItem = FirstType.fromJson(jsonList[i]);
    firstTypeList.add(firstTypeItem);
  }
  // print("${firstTypeList[0].dstName}");

  return firstTypeList;
}